package org.jetlinks.pro.clickhouse.types;

import org.jetlinks.pro.clickhouse.ClickHouseDataType;


public class SimpleDataTypeParser implements DataTypeParser {
    @Override
    public boolean support(String expr) {
        if (expr.contains("(")) {
            return false;
        }
        try {
            parse(expr);
            return true;
        } catch (Throwable e) {
            return false;
        }
    }

    @Override
    public ClickHouseDataType parse(String expr) {
        return SimpleDataType.valueOf(expr);
    }
}
